//
//  GamePlayer.swift
//  ProxyMode
//
//  Created by mac on 2017/10/31.
//  Copyright © 2017年 RRC. All rights reserved.
//

import Foundation

enum GamePlayerError:Error {
    case errorOne
    case errorTwo(String)
}

////////游戏者
public class GamePlayer: IGamePlayer{
    
    private var name:String = "";
    
    init(name:String) throws {
        guard !name.isEmpty else {
            throw GamePlayerError.errorTwo("参数为空")
//            return
        }
        
        self.name = name
    }
    
    func login(user: String, password: String) {
        print("登录名为\(user)的用户\(self.name)登录成功")
    }
    
    func killBoss() {
        print("\(self.name)在打怪")
    }
    
    func upgrade() {
        print("\(self.name)又升了一级")
    }
    
    
}

